// pages/orders/orders.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbar: ["全部","待付款","待发货","待收货","待评价"],
    orders:[{name:"麦穗面包",price:12.00,amount:1,img:"../images/1.jpg"},
            {name:"奶油面包",price:14.00,amount:1,img:"../images/2.jpg"}
          ], 
    currentIndex: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    switch (options.type) {
      case "notpay": 
        this.currentIndex = 1;
        break;
      case "notsend": 
        this.currentIndex = 2;
        break;
      case "notget": 
        this.currentIndex = 3;
        break;
      case "comment": 
        this.currentIndex = 4;
        break;
      case "afterSale": 
        this.currentIndex = 5;
        break;
    }
  },
  navbarTab: function (e) { 
    this.setData({ 
     currentIndex: e.currentTarget.dataset.index
    }); 
  },

  toComplain(){
    wx.navigateTo({
      url: '../complain/complain',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})